<?php

class Editions extends Controller {

    public function __construct() {
        parent::__construct();
    }

    public function index() {
        Routers::changePage('painel_view', array('title' => 'Painel Administrativo'));
    }

    public function page() {
        $em = new EntityManager();
        $exe = $em->prepare("SELECT id FROM edition_page");
        $listPage = array();
        if (!$exe->execute() && $exe->rowCount() == 0) {
            $list = array();
        } else {
            $list = $exe->fetchAll();
            for($i = 0; $i < sizeof($list); $i++) {
                $listPage[] = $em->find(new edition_page(), $list[$i]['id']);
            }
        }
        Routers::changePage('edition_page_view', array('title' => 'Edição - Página', 'listPage' => $listPage));
    }

    public function edit() {
        Routers::changePage('edition_page_view', array('title' => 'Edição - Página'));
    }

    public function delete() {
        Routers::changePage('edition_page_view', array('title' => 'Edição - Página'));
    }

}
